import React from 'react';

import DataManager from '../../datas/DataManager';

export default class BaseExecuter {
  execute(action) {

  }

  call(data) {

  }

  //请求url后返回的数据需要JSON格式的，可以用这个
  _sendRequestCommonResponse(action, methodName) {
    DataManager.callMethod(this._getModuleType(),
      methodName,
      [action.data, (data, isSucceed, response)=>{action.finish(data, isSucceed, response)}]);
  }

  //请求url后返回的数据不需要JSON格式的，可以用这个
  _sendRequestCommon(action, methodName) {
    DataManager.callMethod(this._getModuleType(),
      methodName,
      [action.data, (data, isSucceed)=>{action.finish(data, isSucceed)}]);
  }

  _getModuleType() {
    console.error("此方法必须被重写");
  }
}
